<template>
  <a-card :bordered="false" style="width: 100%">
    <detail-list :col="2">
      <!--<detail-list-item term="培养单位">{{ schemeInfo.pyfa.pydwmc }}&emsp;</detail-list-item>-->
      <!--<detail-list-item term="专业">{{ schemeInfo.pyfa.sszymc }}&emsp;</detail-list-item>-->
      <detail-list-item term="所属年级">{{ schemeInfo.pyfa.ssnjmc }}&emsp;</detail-list-item>
      <detail-list-item term="培养模式">{{ schemeInfo.pyfa.pymsmc }}&emsp;</detail-list-item>
      <detail-list-item term="学科/领域">{{ schemeInfo.pyfa.xkzym + ' ' + schemeInfo.pyfa.xkmc }}&emsp;</detail-list-item>
      <!-- <detail-list-item term="类别">{{ schemeInfo.pyfa.xklbmc }}&emsp;</detail-list-item> -->
      <detail-list-item term="培养类别">{{ schemeInfo.pyfa.xslbmc }}&emsp;</detail-list-item>
      <!-- <detail-list-item term="培养来源">{{ schemeInfo.pyfa.xslxmc }}&emsp;</detail-list-item> -->
      <!-- <detail-list-item term="培养类别">{{ schemeInfo.pyfa.xslbmc }}&emsp;</detail-list-item> -->
      <detail-list-item term="培养方案名称">{{ schemeInfo.pyfa.pyfamc }}&emsp;</detail-list-item>
    </detail-list>

    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="培养方案" key="1">
        <div style="display: flex;margin-top:20px;">
          <div style="flex: 1;color: #000;min-width: 120px;">学科简介：</div>
          <div style="flex: 8">{{ schemeInfo.pyfa.xkjj }}</div>
        </div>
        <div style="display: flex;margin-top:20px;">
          <div style="flex: 1;color: #000;min-width: 120px;">培养目标：</div>
          <div style="flex: 8">{{ schemeInfo.pyfa.pymb }}</div>
        </div>
        <div style="display: flex;margin-top:20px;">
          <div style="flex: 1;color: #000;min-width: 120px;">修业年限：</div>
          <div style="flex: 8">{{ schemeInfo.pyfa.xynx }}</div>
        </div>
        <div style="display: flex;margin-top:20px;">
          <div style="flex: 1;color: #000;min-width: 120px;">说明：</div>
          <div style="flex: 8">{{ schemeInfo.pyfa.xynxsm }}</div>
        </div>
        <div style="display: flex;margin-top:20px;">
          <div style="flex: 1;color: #000;min-width: 120px;">研究方向：</div>
          <div style="flex: 8">{{ schemeInfo.pyfa.yjfx }}</div>
        </div>
        <div style="display: flex;margin-top:20px;">
          <div style="flex: 1;color: #000;min-width: 120px;">学位论文：</div>
          <div style="flex: 8">{{ schemeInfo.pyfa.xwlwsm }}</div>
        </div>
        <div style="display: flex;margin-top:20px;">
          <div style="flex: 1;color: #000;min-width: 120px;">培养方式与方法：</div>
          <div style="flex: 8">{{ schemeInfo.pyfa.pyfsyff }}</div>
        </div>
        <!-- <detail-list size="small" :col="1">
          <detail-list-item term="培养目标">{{ schemeInfo.pyfa.pymb }}</detail-list-item>
          <detail-list-item term="修业年限">{{ schemeInfo.pyfa.xynx }}</detail-list-item>
          <detail-list-item term="说明">{{ schemeInfo.pyfa.xynxsm }}</detail-list-item>
          <detail-list-item term="研究方向">{{ schemeInfo.pyfa.yjfx }}</detail-list-item>
          <detail-list-item term="学位论文">{{ schemeInfo.pyfa.xwlwsm }}</detail-list-item>
          <detail-list-item term="培养方式与方法">{{ schemeInfo.pyfa.pyfsyff }}</detail-list-item>
        </detail-list> -->
      </a-tab-pane>
      <a-tab-pane tab="课程设置" key="2" forceRender>
        <a-table
          :columns="kcColumns"
          :dataSource="schemeInfo.pyfakcList"
          :alert="{show: false}"
          size="middle"
          :pagination="false"
        >
          <!-- :scroll="{ y: 400 }" -->
          <span slot="bxhxx" slot-scope="text">{{ text === '0' ? '选修' : '必修' }}</span>
          <span slot="sfxwk" slot-scope="text">{{ text === '0' ? '否' : '是' }}</span>
        </a-table>
      </a-tab-pane>
      <a-tab-pane tab="培养过程" key="3" forceRender>
        <a-table
          :columns="pkcColumns"
          :dataSource="schemeInfo.pyfaPkcList"
          :alert="{show: false}"
          size="middle"
          :pagination="false"
        >
          <!-- :scroll="{ y: 400 }" -->
          <span slot="bxhxx" slot-scope="text">{{ text === '0' ? '选修' : '必修' }}</span>
          <span slot="sfxwk" slot-scope="text">{{ text === '0' ? '否' : '是' }}</span>
        </a-table>
      </a-tab-pane>
      <a-tab-pane tab="攻读学位学分要求" key="4" forceRender>
        <credit :temp="schemeInfo.pyfa" :pymsmc="schemeInfo.pyfa.pymsmc" ref="credit"/>
      </a-tab-pane>
    </a-tabs>
    <div class="ant-pro-footer-toolbar">
      <a-button style="float: right;margin-top: 10px;" @click="back" type="primary">返回</a-button>
    </div>
  </a-card>
</template>

<script>
import DetailList from '~/tool/DetailList'
import credit from './add/components/credit'
const DetailListItem = DetailList.Item

export default {
  data () {
    return {
      schemeInfo: {
        pyfa: {},
        pyfakcList: [],
        pyfaPkcList: []
      },
      kcColumns: [
        {
          title: '课程代码',
          dataIndex: 'kcdm',
          width: '15%'
        },
        {
          title: '课程名称',
          dataIndex: 'kcmc',
          width: '20%'
        },
        {
          title: '学时',
          width: 80,
          dataIndex: 'xs'
        },
        {
          title: '学分',
          width: 80,
          dataIndex: 'xf'
        },
        {
          title: '课程类型',
          dataIndex: 'kclxmc',
          width: '10%'
        },
        {
          title: '是否学位课',
          dataIndex: 'sfxwkmc',
          width: 100
        },
        {
          title: '修课要求',
          dataIndex: 'bxhxxmc',
          width: 80
        }
      ],
      pkcColumns: [
        {
          title: '课程代码',
          dataIndex: 'kcdm',
          width: '15%'
        },
        {
          title: '课程名称',
          dataIndex: 'kcmc',
          width: '20%'
        },
        {
          title: '学时',
          width: 80,
          dataIndex: 'xs'
        },
        {
          title: '学分',
          width: 80,
          dataIndex: 'xf'
        },
        {
          title: '课程类型',
          dataIndex: 'kclxmc',
          width: '10%'
        }
      ]
    }
  },
  components: {
    DetailList,
    DetailListItem,
    credit
  },
  created () {
    this.$api.cultivate.schemeDetail(this.$route.params.id).then(res => {
      this.schemeInfo = res.data
      let creditKeys = Object.keys(this.$refs.credit.form.getFieldsValue())
      creditKeys.forEach(key => {
        let obj = {}
        obj[key] = res.data.pyfa[key]
        this.$refs.credit.form.setFieldsValue(obj)
      })
    })
  },
  methods: {
    back() {
      this.$router.back()
    }
  }
}
</script>

<style>

</style>
